home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 83win / data1.cab / Basic_Plus_Examples / BKGNDBMP < prev    next >
Encoding:
Text File  |  2001-03-02  |  2.3 KB  |  74 lines

  1. 10   ! ******************************************************************
  2. 20   !  Example: Background Bitmap
  3. 30   !
  4. 40   !  This program demonstrates the BACKGROUND BITMAP attribute
  5. 50   !  of the PANEL widget by allowing you to bring in a bitmap
  6. 60   !  file and use it to tile the PANEL.
  7. 70   !
  8. 80   ! ******************************************************************
  9. 90    !
  10. 100   ! Some variables:
  11. 110   !
  12. 120   !   S$:        String variable
  13. 130   !   M$:        SYSTEM MENU array
  14. 140   !   F$:        Bitmap file name
  15. 150   !   N:        INTEGER variable
  16. 160   !   Btn:        Variable to get button inputs from dialogs
  17. 170   !   D(*):        Array to get display dimensions
  18. 180   !   Dw,Dh:        Display dimensions
  19. 190   !
  20. 200       DIM S$[256],M$(0:1)[32],F$[50]
  21. 210       INTEGER N,Btn,D(1:4),Dw,Dh
  22. 220   !
  23. 230   ! Get display size
  24. 240   !
  25. 250       GESCAPE CRT,3;D(*)! Gets display lines
  26. 260       Dw=D(3)-D(1)
  27. 270       Dh=(D(4)-D(2))
  28. 280   !
  29. 290   ! Set up SYSTEM MENU array
  30. 300   !
  31. 310       M$(0)="Get Bitmap File"
  32. 320       M$(1)="Quit"
  33. 330   !
  34. 340   ! Create the PANEL widget, add a toaster menu
  35. 350   !
  36. 360       CLEAR SCREEN
  37. 370       ASSIGN @Main TO WIDGET "PANEL";SET ("VISIBLE":0)
  38. 380       CONTROL @Main;SET ("X":50,"Y":20,"WIDTH":.8*Dw,"HEIGHT":.8*Dh)
  39. 390       CONTROL @Main;SET ("MAXIMIZABLE":0,"RESIZABLE":0)
  40. 400       CONTROL @Main;SET ("TITLE":" Example: Background Bitmap")
  41. 410       CONTROL @Main;SET ("SYSTEM MENU":M$(*),"VISIBLE":1)
  42. 420   !
  43. 430       ON EVENT @Main,"SYSTEM MENU" GOSUB Handler
  44. 440       LOOP
  45. 450           WAIT FOR EVENT
  46. 460       END LOOP
  47. 470       STOP
  48. 480   !
  49. 490   ! ***************** End of Main Program ***********************
  50. 500   !
  51. 510  Handler:!
  52. 520       STATUS @Main;RETURN ("SYSTEM MENU EVENT":N)
  53. 530       SELECT N
  54. 540       CASE 0
  55. 550           S$="Please enter bitmap file name:"
  56. 560           DIALOG "FILE",S$,Btn;RETURN ("SELECTION":F$)
  57. 570           IF Btn=0 THEN
  58. 580               CLEAR ERROR
  59. 590               ON ERROR GOSUB Errtrap
  60. 600               CONTROL @Main;SET ("BACKGROUND BITMAP":F$)
  61. 610               OFF ERROR
  62. 620               IF ERRN<>0 THEN DIALOG "ERROR",ERRM$
  63. 630           END IF
  64. 640       CASE 1
  65. 650           GOTO Finis
  66. 660       END SELECT
  67. 670       RETURN
  68. 680   !
  69. 690  Errtrap: ERROR RETURN
  70. 700   !
  71. 710  Finis:!
  72. 720       ASSIGN @Main TO *! Delete PANEL Widget
  73. 730       END
  74.